<!DOCTYPE html>
<html>
<head>
    <title>维护规程管理</title>
    #parse("sys/header.html")
    <style>
        .sugon_upload_btn {
            display: -webkit-inline-box;
            display: inline-block;
        }

        .leftHeight{
            height: 85vh;
            overflow: auto;
        }
        ::-webkit-scrollbar{
            width: 10px;
            height: 10px;
        }
        ::-webkit-scrollbar-thumb{
            border-radius: 10px;
            -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
            background: #a8a5a5;
        }
        .workShop{
            position: absolute;
            top: 0;
            width: 100%;
            height: 25px;
            background-color: white;
        }
    </style>
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="3">
                    <i-input v-model="q.name" @on-enter="query" placeholder="规程名称"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.planVersion" @on-enter="query" placeholder="版本名称"></i-input>
                </i-col>
                <i-col span="3">
                    <i-input v-model="q.devCode" @on-enter="query" placeholder="设备编码"></i-input>
                </i-col>
                <i-col span="3">
                    <i-select v-model="q.progress" placeholder="审核状态">
                        <i-option value="">请选择</i-option>
                        <i-option v-for="status in statusList" :value="status.value" :key="status.value">{{status.name}}</i-option>
                    </i-select>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <Row :gutter="16" style="margin: 3px 0px 0px 0px;">
            <div class="buttons-group">
                #if($shiro.hasPermission("devmaintenplan:imports"))
                <Upload ref="uploadFile"
                        action="../devmaintenplan/imports"
                        :format ="['xlsx','xls']"
                        :before-upload="handleBeforeUpload"
                        :show-upload-list="false"
                        :on-success="handleSuccess" :on-error="handleError"
                        :on-format-error="handleFormatError" class="sugon_upload_btn">
                    <i-button type="primary"><i class="fa fa-hand-o-down"></i>&nbsp;导入</i-button>
                </Upload>
                <i-button type="primary" @click="exportData"><i class="fa fa-hand-o-up"></i>&nbsp;导出</i-button>
                #end
                #if($shiro.hasPermission("devmaintenplan:check"))
                <i-button type="primary" @click="check"><i class="fa fa-gavel"></i>&nbsp;车间审批</i-button>
                #end
                #if($shiro.hasPermission("devmaintenplan:okCheck"))
                <i-button type="primary" @click="okCheck"><i class="fa fa-gavel"></i>&nbsp;PE审批</i-button>
                #end
                #if($shiro.hasPermission("devmaintenplan:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("devmaintenplan:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("devmaintenplan:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
            </div>
        </Row>
        <Row>
            <i-col :xs="3" :sm="3" :md="3" :lg="3">
                <div class="leftHeight" >
                    <div class="workShop">
                        <p class="text-center" style="font-size: 15px;">工厂/基地</p>
                    </div>
                    <div id="storeLayer" style="margin-top: 25px">
                        <ul id="storeTree" class="ztree"></ul>
                    </div>
                </div>
            </i-col>
            <i-col span="21">
                <table id="jqGrid"></table>
            </i-col>
        </Row>
    </div>
    <!-- 审核表单区域 -->
    <div id="reviewLayer" style="padding: 20px;display: none">
        <i-form :model="approveParam" :label-width="80">
            <Form-item label="审核状态：">
                <Radio-group v-model="approveParam.status">
                    <Radio :label="1"><span>通过</span></Radio>
                    <Radio :label="2"><span>不通过</span></Radio>
                </Radio-group>
            </Form-item>
            <Form-item label="备注：">
                <i-input type="textarea" v-model="approveParam.remark" :rows="3" placeholder="请输入..."></i-input>
            </Form-item>
        </i-form>
    </div>

    <Card v-show="!showList">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="devMaintenPlan" :rules="ruleValidate" :label-width="100">
            <Row>
                <i-col span="11">
                    <Form-item label="规程名称" prop="ruleName">
                        <i-input v-model="devMaintenPlan.ruleName" placeholder="规程名称"></i-input>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="规程类型" prop="reserve1">
                        <i-select v-model="devMaintenPlan.reserve1">
                            <i-option v-for="type in typeList" :value="type.value" :key="type.value">{{type.name}}
                            </i-option>
                        </i-select>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="设备编码" prop="devCode">
                        <i-input v-model="devMaintenPlan.devCode" icon="md-arrow-dropdown-circle" @on-click="getDeviceInfo" placeholder="设备编码"/>
                    </Form-item>
                </i-col>
                <i-col span="11">
                    <Form-item label="设备名称" prop="devName">
                        <i-input v-model="devMaintenPlan.devName" readonly placeholder="设备名称"/>
                    </Form-item>
                </i-col>
            </Row>
            <Row>
                <i-col span="11">
                    <Form-item label="内容" prop="planCon">
                        <i-input v-model="devMaintenPlan.planCon" placeholder="内容" type="textarea"></i-input>
                    </Form-item>
                </i-col>
            </Row>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px">
                    返回
                </i-button>
                <i-button type="info" @click="handleReset('formValidate')" style="margin-left: 8px">重置
                </i-button>
            </Form-item>
        </i-form>
    </Card>
    <div id="planData" style="display: none">
        <!--<p slot="title">{{title_plan}}</p>-->
        <i-form ref="formValidateResource" :model="maintain_plan" :rules="ValidateResource" :label-width="100">
            <Form-item label="计划名称" prop="planName">
                <i-input v-model="maintain_plan.planName" placeholder="计划名称" class="from_tab_wide"></i-input>
            </Form-item>
            <!--<Form-item label="所属车间" prop="dept">-->
            <!--<i-select v-model="maintain_plan.dept" class="from_tab_wide" @on-change="deptListData">-->
            <!--<i-option v-for="item in deptList" :value="item.DEPT_ID" :key="item.DEPT_ID">{{ item.NAME }}</i-option>-->
            <!--</i-select>-->
            <!--</Form-item>-->
            <Form-item label="生产线" prop="beltline">
                <!--<i-select v-model="maintain_plan.beltline" class="from_tab_wide">-->
                <!--<i-option v-for="item in beltlineList" :value="item.value" :key="item.value">{{ item.label }}</i-option>-->
                <!--</i-select>-->
                <i-input v-model="maintain_plan.beltlineName" disabled @on-click="deptTreeShow" class="from_tab_wide"
                         icon="fa fa-deafness"></i-input>
            </Form-item>
            <Form-item label="执行时间" prop="carryDate">
                <Date-picker v-model="maintain_plan.carryDate" type="datetime" format="yyyy-MM-dd HH:mm"
                             placeholder="选择日期和时间（不含秒）"
                             class="from_tab_wide"></Date-picker>
            </Form-item>
            <Form-item label="完成时间" prop="completeDate">
                <Date-picker v-model="maintain_plan.completeDate" type="datetime" format="yyyy-MM-dd HH:mm"
                             placeholder="选择日期和时间（不含秒）"
                             class="from_tab_wide"></Date-picker>
            </Form-item>
            <Form-item label="备注">
                <i-input v-model="maintain_plan.remark" type="textarea" :autosize="{minRows: 8,maxRows: 5}"
                         placeholder="请输入..."
                         class="from_tab_wide"></i-input>
            </Form-item>
        </i-form>
    </div>
</div>
<div id="categoryLayer" style="display: none;padding:10px;">
    <ul id="categoryTree" class="ztree"></ul>
</div>
<script src="${rc.contextPath}/js/device/devmaintenplan.js?_${date.systemTime}"></script>
</body>
</html>
<style>
    .from_tab_wide {
        width: 90% !important;
        padding-top: 1% !important;
    }
</style>
